package com.spring.sunflower.conversation

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.makeramen.roundedimageview.RoundedImageView
import com.spring.sunflower.R
import com.spring.sunflower.bean.*
import com.spring.sunflower.util.DateTimeUtils
import java.util.*

/**
 * Created by Kevin on 2021/8/28<br/>
 *
 * Describe:<br/>
 */
class CallRecordAdapter(layoutResId: Int, data: MutableList<CallRecordBean.DatasBean>) :
    BaseQuickAdapter<CallRecordBean.DatasBean, BaseViewHolder>(layoutResId, data) {
    override fun convert(holder: BaseViewHolder, item: CallRecordBean.DatasBean) {
//        when (item.status) {
//            "0" -> {//待审核
//                holder.setText(
//                    R.id.tvTitle,
//                    "钻石提现(审核中)"
//                )
//            }
//            "1" -> {//已通过
//                holder.setText(
//                    R.id.tvTitle,
//                    "钻石提现(已通过)"
//                )
//            }
//            "2" -> {//拒绝
//                holder.setText(
//                    R.id.tvTitle,
//                    "钻石提现(已拒绝)"
//                )
//            }
//        }
        val iv = holder.getView<RoundedImageView>(R.id.rivAvatar)
        Glide.with(context)
            .load(item.photo)
            .placeholder(R.drawable.ic_placeholder)
            .error(R.drawable.ic_placeholder)
            .into(iv)
        holder.setText(
            R.id.tvTitle,
            "${item.nickname}"
        )
        val timeFormatText = DateTimeUtils.getTimeFormatText(Date((item.createTime).toLong()))
        holder.setText(R.id.tvTime, timeFormatText)
//        val tvDetail = holder.getView<TextView>(R.id.tvDetail)
//        tvDetail.text = "-${item.amount}"
//        tvDetail.setTextColor(ContextCompat.getColor(context, R.color.green))


//        val ivMoney: ImageView = holder.getView(R.id.ivMoney)
//        ivMoney.setImageResource(R.drawable.ic_income_diamond)

    }
}